home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
C/C++ Interactive Reference Guide
/
C-C++ Interactive Reference Guide.iso
/
c_ref
/
csource5
/
355_01
/
slk1.exe
/
SHERLOCK
/
SL.H
< prev
next >
Wrap
C/C++ Source or Header
|
1991-06-09
|
8KB
|
296 lines
/*
Header file for Sherlock version 2 of the Sherlock macros.
source: sl.h
started: September 27, 1985
version:
1.1 February 16, 1989
1.5 August 3, 1989
1.6 April 17, 1990
1.7 June 15, 1991
PUBLIC DOMAIN SOFTWARE
Sherlock, including the SPP, SDEL and SDIF programs, was placed in
the public domain on June 15, 1991, by its author,
Edward K. Ream
166 North Prospect Ave.
Madison, WI 53705.
(608) 257-0802
Sherlock may be used for any commercial or non-commercial purpose.
DISCLAIMER OF WARRANTIES
Edward K. Ream (Ream) specifically disclaims all warranties,
expressed or implied, with respect to this computer software,
including but not limited to implied warranties of merchantability
and fitness for a particular purpose. In no event shall Ream be
liable for any loss of profit or any commercial damage, including
but not limited to special, incidental consequential or other damages.
*/
#define SL_VERSION_NAME "1.6"
/*
NOTE 1: You must include this file (or sl1.h) in every file that
contains any Sherlock macro. This file, rather than sl1.h,
is the prefered file to include because the version 2 routines
run faster.
NOTE 2: If you want the sherlock macros to be enabled, you must
define the SHERLOCK symbol BEFORE including this file.
NOTE 3: This file uses functions prototypes from the new ANSI standard.
When older compilers, undefine HAS_ANSI_PROTOTYPES.
*/
#define HAS_ANSI_PROTOTYPES 1
/* Synonyms. */
#define LEAVE(a) TICKX(a)
#define ENTER(a) TICKB(a)
#define ENTER_TRACE(a,b) TRACEPB(a,b)
/* Always define these. */
#define SL_DISABLE()
#define SL_ENABLE()
#ifdef SHERLOCK
/* Macros common to version 1 and version 2. */
#define SL_CLEAR() sl_clear()
#define SL_DUMP() sl_dump()
#define SL_INIT() sl_init(SL_VERSION_NAME)
#define SL_NAME(a,b) static char a [] = b
#define SL_OFF(s) sl_off(s)
#define SL_ON(s) sl_on(s)
#define SL_PARSE(argc,argv,on,off) sl_parse(&argc,argv,on,off)
/*
Note: Routines that exit from a nesting level do NOT need a handle
parameter because the call_stack provides it.
*/
/* Make SURE that the expression is evaluated exactly once. */
#define RETURN_BOOL(a,b) return sl_xb(a,b)
#define RETURN_CHAR(a,c) return sl_xc(a,c)
#define RETURN_DOUBLE(a,d) return sl_xd(a,d)
/* Floats passed as doubles. */
#define RETURN_FLOAT(a,f) return sl_xd(a,f)
#define RETURN_INT(a,i) return sl_xi(a,(int)i)
#define RETURN_LONG(a,l) return sl_xl(a,l)
#define RETURN_PTR(a,p) return sl_xp(a,p)
#define RETURN_STRING(a,s) return sl_xs(a,s)
#define RETURN_UINT(a,ui) return sl_xui(a,ui)
#define RETURN_ULONG(a,ul) return sl_xul(a,ul)
#define RETURN_VOID(a) {sl_xv(a); return;}
#define STATX(a) sl_xtrace(a); /* Ignore the return code. */
#define TICKX(a) sl_x(a)
#define TICKX_BOOL(a,b) sl_xb(a,b)
#define TICKX_CHAR(a,c) sl_xc(a,c)
#define TICKX_DOUBLE(a,d) sl_xd(a,d)
#define TICKX_FLOAT(a,f) sl_xf(a,f)
#define TICKX_INT(a,i) sl_xi(a,i)
#define TICKX_LONG(a,l) sl_xl(a,l)
#define TICKX_PTR(a,p) sl_xp(a,p)
#define TICKX_STRING(a,s) sl_xs(a,s)
#define TICKX_UINT(a,u) sl_xui(a,u)
#define TICKX_ULONG(a,u) sl_xul(a,u)
#define TICKX_VOID(a) sl_xv(a)
#define TRACEX(a,b) if(sl_xtrace(a)) {b;}
#define TRACEPX(a,b) if(sl_pxtrace(a)) {b;}
/* Macros for routines which are unique to version 2. */
#define STAT(a) {static void *h=0; sl2stat(&h,a);}
#define STATB(a) {static void *h=0; sl2bstat(&h,a);}
#define TICK(a) {static void *h=0; sl2tick(&h,a);}
#define TICKB(a) {static void *h=0; sl2btick(&h,a);}
#define TICKN(a) {static void *h=0; sl2ntick(&h,a);}
#define TRACE(a,b) {static void *h=0; if(sl2trace(&h,a)) {b;}}
#define TRACEB(a,b) {static void *h=0; if(sl2btrace(&h,a)) {b;}}
#define TRACEN(a,b) {static void *h=0; if(sl2ntrace(&h,a)) {b;}}
#define TRACEP(a,b) {static void *h=0; if(sl2ptrace(&h,a)) {b;}}
#define TRACEPB(a,b) {static void *h=0; if(sl2pbtrace(&h,a)) {b;}}
#define TRACEPN(a,b) {static void *h=0; if(sl2pntrace(&h,a)) {b;}}
/*
Function prototypes.
*/
#ifdef HAS_ANSI_PROTOTYPES
/* Routines common to Version 1 and Version 2. */
void sl_dump (void);
void sl_init (char *);
void sl_off (char *);
void sl_on (char *);
void sl_parse (int *,char **,char *,char *);
int sl_pxtrace (char *); /* TRACEPX */
void sl_x (char *); /* TICKX */
int sl_xb (char *,int);
char sl_xc (char *,char);
double sl_xd (char *,double);
double sl_xf (char *,double);
int sl_xi (char *,int);
long sl_xl (char *,long);
void * sl_xp (char *,void *);
char * sl_xs (char *,char *);
int sl_xtrace (char *); /* TRACEX */
unsigned int sl_xui (char *,unsigned int);
unsigned long sl_xul (char *,unsigned long);
void sl_xv (char *);
void sl_bout (int);
void sl_cout (char);
void sl_dout (double);
void sl_fout (double); /* Floats are passed as doubles. */
void sl_iout (int);
void sl_lout (long);
void sl_pout (void *);
char * sl_sbout(int);
void sl_sout (char *);
void sl_uiout(unsigned int);
void sl_ulout(unsigned long);
void sl_csout(void);
void sl_lpout(void);
void sl_rpout(void);
/* Version 2 routines. */
void sl2bstat (void *,char *);
void sl2btick (void *,char *);
int sl2btrace (void *,char *);
void sl2ntick (void *,char *);
int sl2ntrace (void *,char *);
int sl2pbtrace (void *,char *);
int sl2pntrace (void *,char *);
int sl2ptrace (void *,char *);
void sl2stat (void *,char *);
void sl2tick (void *,char *);
int sl2trace (void *,char *);
#else
void sl_dump();
void sl_init();
void sl_off();
void sl_on();
void sl_parse();
int sl_pxtrace(); /* TRACEPX */
void sl_x(); /* TICKX */
int sl_xb();
char sl_xc();
double sl_xd();
double sl_xf();
int sl_xi();
long sl_xl();
void * sl_xp();
char * sl_xs();
int sl_xtrace(); /* TRACEX */
unsigned int sl_xui();
unsigned long sl_xul();
void sl_xv();
void sl_bout();
void sl_cout();
void sl_csout();
void sl_dout();
void sl_fout();
void sl_iout();
void sl_lout();
void sl_pout();
char * sl_sbout();
void sl_sout();
void sl_uiout();
void sl_ulout();
void sl_csout();
void sl_lpout();
void sl_rpout();
void sl2bstat();
void sl2btick();
int sl2btrace();
void sl2ntick();
int sl2ntrace();
int sl2pbtrace();
int sl2pntrace();
int sl2ptrace();
void sl2stat();
void sl2tick();
int sl2trace();
#endif /* HAS_ANSI_PROTOTYPES */
#else
/*
Null macro definitions for all Sherlock macros.
*/
#define RETURN_BOOL(a,b) return b
#define RETURN_CHAR(a,c) return c
#define RETURN_DOUBLE(a,d) return d
#define RETURN_FLOAT(a,f) return f
#define RETURN_INT(a,i) return i
#define RETURN_LONG(a,l) return l
#define RETURN_PTR(a,p) return p
#define RETURN_STRING(a,s) return s
#define RETURN_UINT(a,u) return u
#define RETURN_ULONG(a,u) return u
#define RETURN_VOID(a) return
#define SL_CLEAR()
#define SL_DUMP()
#define SL_INIT()
#define SL_NAME(a,b)
#define SL_OFF(s)
#define SL_ON(s)
#define SL_PARSE(argc,argv,on,off)
#define STAT(a)
#define STATB(a)
#define STATX(a)
#define TICK(a)
#define TICKB(a)
#define TICKN(a)
#define TICKX(a)
#define TICKX_BOOL(a,b)
#define TICKX_CHAR(a,c)
#define TICKX_DOUBLE(a,d)
#define TICKX_FLOAT(a,f)
#define TICKX_INT(a,i)
#define TICKX_LONG(a,l)
#define TICKX_PTR(a,p)
#define TICKX_STRING(a,s)
#define TICKX_UINT(a,u)
#define TICKX_ULONG(a,u)
#define TICKX_VOID(a)
#define TRACE(a,b)
#define TRACEB(a,b)
#define TRACEN(a,b)
#define TRACEX(a,b)
#define TRACEP(a,b)
#define TRACEPB(a,b)
#define TRACEPN(a,b)
#define TRACEPX(a,b)
#endif /* ifdef SHERLOCK */